package com.hmall.search.ma;

import com.hmall.search.pojo.MqConstants;
import com.hmall.search.service.DataServiceCRUD;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class ListenerMq {
    @Autowired
    public DataServiceCRUD dataServiceCRUD;


    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void updata(long id) throws IOException {
        dataServiceCRUD.Update(id);
    }
    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void delete(long id) throws IOException {
        dataServiceCRUD.deleteById(id);
    }
}
